package com.zyc.app.woa.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.zyc.app.woa.R;
import com.zyc.app.woa.data.AccountInfo;
import com.zyc.app.woa.utils.CommonUtils;

/**
 * Author: yingchang.zhang
 * Date  : 2014/12/24
 */
public class DeleteAccountDialog extends PopDialog {
    private TextView mContentText;
    private Button mOkButton;
    private Button mCancelButton;
    private AccountInfo mAccountInfo;
    private View.OnClickListener mOnClickListener;

    public DeleteAccountDialog(Context context, AccountInfo accountInfo) {
        super(context);
        mAccountInfo = accountInfo;
    }

   public void setOnDeleteButtonClickListener(View.OnClickListener listener) {
      mOnClickListener = listener;
   }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.delete_account_dialog);
        mOkButton = (Button) findViewById(R.id.ok_button);
        mCancelButton = (Button) findViewById(R.id.cancel_button);
        mContentText = (TextView) findViewById(R.id.detail_text);
        mContentText.setText(CommonUtils.getString(R.string.sure_delete_account, mAccountInfo.name));
        setCanceledOnTouchOutside(true);
        mCancelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               dismiss();
            }
        });

        mOkButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                dismiss();
                if (null != mOnClickListener) {
                    mOnClickListener.onClick(v);
                }
            }
        });
    }
}
